home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
daten
/
quickfile
/
arexx
/
delrecs.quickfile
< prev
next >
Wrap
Text File
|
1995-04-06
|
2KB
|
84 lines
/*
DeleteRecs.QuickFile
Deletes all records in the current index (hopefully a selection)
Asks for confirmation before it alters the file
Run this from the 'Options/Arexx macro' menu item
Author: Alan Wigginton
Date: March 1995
*/
options results
if ~open(console,"con:20/40/460/120/SetField","W") then
do
say "Could not open window"
exit(20)
end
"setindex" /* get the current index name */
ixname = result
"query index ixfld '"ixname"'" /* get the index field names */
if rc > 0 then
call ErrorProc "Error getting index details"
call writeln(console, "Mass delete of records")
call writeln(console, "- deletes all records in the current index")
/*
Confirm operation and number of records to be deleted
*/
"numrecs" /* ask quickfile for the number of records */
numrecs = result
call writeln(console, "About to delete" numrecs "records")
call writeln(console, "Enter Y to continue")
ans = upper(readln(console))
if ans ~= "Y" then
do
call writeln(console, "Request cancelled - press any key")
ans = readln(console)
exit
end
"next -32000" /* This goes to top of file */
/*
Delete the records
*/
do count = 1 to numrecs
"delrec"
if rc > 0 then
do
call writeln(console, "Error from DelRec after")
call ErrorProc count "records deleted"
end
end
/*
Tell the user that we completed it OK
*/
call writeln(console, numrecs "records deleted")
call writeln(console, "Press RETURN to continue")
ans = readln(console)
exit
/*
Display error message and exit
------------------------------
*/
ErrorProc:
arg errmsg
call writeln(console, errmsg)
call writeln(console, "Press RETURN to continue")
ans = readln(console)
exit(10)